//
//  duibiaoDataTableCellview.m
//  cocoapodText
//
//  Created by apple on 16/9/27.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ShiPei.h"
#import <Foundation/Foundation.h>
#import "duibiaoDataTableCellview.h"

@interface duibiaoDataTableCellview()
@end

@implementation duibiaoDataTableCellview
/**
 *  初始化视图属性
 *
 *  @param frame 视图frame
 *
 *  @return self
 */
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //定制View
        self.backgroundColor = [UIColor clearColor];
        self.userInteractionEnabled = YES; //设置为NO后，不再响应touch方法
        self.multipleTouchEnabled = YES;
        //控制子视图不能超出父视图的范围
        self.clipsToBounds = YES;
        //添加子视图
        [self subView];
    }
    return self;
}

//子视图懒加载
-(void)subView{
    UIView *allBackView=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :0 :630 :35]];
    [self addSubview:allBackView];
    [allBackView setUserInteractionEnabled:YES];
    [allBackView setBackgroundColor:[UIColor clearColor]];
    self.allBackView=allBackView;
    //名称250
    UILabel *itemName=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:0 :0 :125 :35]];
    [allBackView addSubview:itemName];
    [itemName setText:@""];
    [itemName setTextColor:FUIColorFromRGB(0x333333)];
    [itemName setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemName setTextAlignment:NSTextAlignmentCenter];
    self.itemName=itemName;
    //合计250
    UILabel *itemKWH=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:125 :0 :125 :35]];
    [allBackView addSubview:itemKWH];
    [itemKWH setText:@""];
    [itemKWH setTextColor:FUIColorFromRGB(0x333333)];
    [itemKWH setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemKWH setTextAlignment:NSTextAlignmentCenter];
    self.itemKWH=itemKWH;
    //约标煤250
    UILabel *itemCoal=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:250 :0 :125 :35]];
    [allBackView addSubview:itemCoal];
    [itemCoal setText:@""];
    [itemCoal setTextColor:FUIColorFromRGB(0x333333)];
    [itemCoal setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemCoal setTextAlignment:NSTextAlignmentCenter];
    self.itemCoal=itemCoal;
    //约标碳排放250
    UILabel *itemCarbon=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:375 :0 :125 :35]];
    [allBackView addSubview:itemCarbon];
    [itemCarbon setText:@""];
    [itemCarbon setTextColor:FUIColorFromRGB(0x333333)];
    [itemCarbon setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemCarbon setTextAlignment:NSTextAlignmentCenter];
    self.itemCarbon=itemCarbon;
    //最大最小250
    UILabel *itemMaxmin=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:500 :0 :130 :35]];
    [allBackView addSubview:itemMaxmin];
    [itemMaxmin setText:@""];
    [itemMaxmin setTextColor:FUIColorFromRGB(0x333333)];
    [itemMaxmin setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemMaxmin setTextAlignment:NSTextAlignmentCenter];
    self.itemMaxmin=itemMaxmin;
}

-(void)setName:(NSString *)name{
    [self.itemName setText:name];
}

-(void)setKWH:(NSString *)kwh{
    kwh=[CommonTool keepDecimal:kwh];
    [self.itemKWH setText:kwh];
}

-(void)setCoal:(NSString *)coal{
    coal=[CommonTool keepDecimal:coal];
    [self.itemCoal setText:coal];
}

-(void)setCarbon:(NSString *)carbon{
    carbon=[CommonTool keepDecimal:carbon];
    [self.itemCarbon setText:carbon];
}

-(void)setMaxmin:(NSString *)maxmin{
    maxmin=[CommonTool keepDecimal:maxmin];
     [self.itemMaxmin setText:maxmin];
}

@end
